package information;

import information.details.StorageAccessDetails;
import information.details.StorageDetails;
import information.details.VinylDetails;

import quary.QuaryBridge;

public class VinylInformation extends AbstractInformation{

	private static final long serialVersionUID = 1L;
	
	private static final int WIDTH = 780 / 3;
	
	private VinylDetails vinylDetails = new VinylDetails(WIDTH);
	private StorageDetails storageDetails = new StorageDetails(WIDTH);
	private StorageAccessDetails storageAccess = new StorageAccessDetails(WIDTH);

	private QuaryBridge quaryBridge;

	public VinylInformation(QuaryBridge quaryBridge) {
		super();
		
		this.quaryBridge = quaryBridge;
		
		this.add(vinylDetails);
		this.add(storageDetails);
		this.add(storageAccess);
	}
	
	public void populate(int vinylID, int storageID) {
		vinylDetails.populateDetails(quaryBridge.getVinylData(vinylID));
		storageDetails.populateDetails(quaryBridge.getStorageData(storageID));
		storageAccess.populateDetails(quaryBridge.getStorageAccessData(storageID));
	}
	
	public void clear() {
		vinylDetails.clear();
		storageDetails.clear();
		storageAccess.clear();
	}
}
